<?php

header('content-type:text/html;charset=utf-8');
$dbname = array(
  'host' => 'localhost:3306',
  'root' => 'root',
  'pass' => '123456',
  'db' => 'qfstudents'
);
$conn=@new mysqli($dbname['host'],$dbname['root'],$dbname['pass']);
// var_dump($conn);
if($conn->connect_errno){
  die("链接错误$conn->connect_errno");
}
$conn->query('set names utf-8');
$result=$conn->select_db($dbname['db']);
if(!$result){
  die("选择数据库错误".$conn->error);
}
?>